<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
	session_start();
	$_SESSION['Admin'] = "IN";
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator</title>
<style type="text/css">
#DivHR {
	position:absolute;
	width:981px;
	height:28px;
	z-index:2;
	left: 247px;
	top: 118px;
}
#apDiv2 {
	position:absolute;
	width:572px;
	height:115px;
	z-index:4;
	left: 340px;
	top: 243px;
}
#apDiv1 {
	position:absolute;
	width:298px;
	height:115px;
	z-index:5;
	left: 540px;
	top: 210px;
}
</style>
</head>

<body>
<pre><p>                           <a href="index.php" ><img src="../Resources/eMart logo.png" width="170" height="67" alt="Logo" /></a>                                                               <b><a  style="color:#000; text-decoration:none;" href="customer_support.php">Customer Support</a>  |  <a style="color:#000; text-decoration:none;" href="Terms.php">Privacy Policy</a></b>
<div id="DivHR"><hr/></div>
<div id='apDiv2'>


<?php 
	
	if ($_SESSION['Admin'] == "IN")
	{
								
		echo"<table width='154' height='136'  border='1' align='center' bordercolor='#6666FF'>
		  <tr>
			<td><table bordercolor='#6666FF'>
			  <tr>
				<td>Sql Query</td>
				<td><textarea cols='80' rows='4' name='sql'></textarea></td>
				<td><input type='submit' value='Run' name='query' /></td>
			  </tr>
			</table></td>
		  </tr>
		  </table>
		</form>";
		echo "     <a href='Products.table.php'><input type='button' value='View Products Table' name='products_button' /></a> <a href='Admin.table.php'><input type='button' value ='View Admin Table' name='admin_button'/></a> <a href='admin.help.php'><input type='button' value='Admin Help'/></a>
		
		<a href='index.php'><h4>Logout</a> as Admin</h4>";
	}
?>
</div>
<div id='apDiv1'>
<?php
	if($_SESSION['Admin'] == "OUT")
	 echo "<center><h3>You do not have permissions to view this page<br/>click <a href='login.php'>here</a> to login</h3></center>"; 
?>
</div>
</body>

<?php

if (isset ($_POST['query']))
{
	$connect = mysql_connect("localhost","root","") or die ("Could not connect to Server");
	mysql_select_db ("web project",$connect);
	
	$query = $_POST['sql'];
	
	mysql_query($query);
	
	mysql_close($connect);
	
}


?>
</html>